package com.moutai.wmo.core.result;

public class ResultUtil {

    /**
     * 成功
     */
    public static <T> ResponseResult<T> success() {
        return new ResponseResult<>(ResultEnum.OPERATE_SUCCESS);
    }

    public static <T> ResponseResult<T> success(ResultEnum resultEnum) {
        return new ResponseResult<>(resultEnum);
    }

    public static <T> ResponseResult<T> success(ResultEnum resultEnum, T data) {
        ResponseResult<T> result = new ResponseResult<>(resultEnum);
        result.setData(data);
        return result;
    }

    public static <T> ResponseResult<T> success(String msg, T data) {
        ResponseResult<T> resultSuccess = new ResponseResult<>(ResultEnum.OPERATE_SUCCESS);
        resultSuccess.setMsg(msg);
        return resultSuccess;
    }

    public static <T> ResponseResult<T> successMsg(String msg) {
        ResponseResult<T> resultSuccess = new ResponseResult<>(ResultEnum.OPERATE_SUCCESS);
        resultSuccess.setMsg(msg);
        return resultSuccess;
    }

    public static <T> ResponseResult<T> successData(T data) {
        ResponseResult<T> resultSuccess = new ResponseResult<>(ResultEnum.OPERATE_SUCCESS);
        resultSuccess.setData(data);
        return resultSuccess;
    }


    /**
     * 失败
     **/
    public static <T> ResponseResult<T> failure() {
        return new ResponseResult<>(ResultEnum.OPERATE_FAILURE);
    }

    public static <T> ResponseResult<T> failure(ResultEnum resultEnum) {
        return new ResponseResult<>(resultEnum);
    }

    public static <T> ResponseResult<T> failure(ResultEnum resultEnum, T data) {
        ResponseResult<T> result = new ResponseResult<>(resultEnum);
        result.setData(data);
        return result;
    }

    public static <T> ResponseResult<T> failureMsg(String message) {
        ResponseResult<T> resultFailure = new ResponseResult<>(ResultEnum.OPERATE_FAILURE);
        resultFailure.setMsg(message);
        return resultFailure;
    }

    public static <T> ResponseResult<T> failureData(T data) {
        ResponseResult<T> resultFailure = new ResponseResult<>(ResultEnum.OPERATE_FAILURE);
        resultFailure.setData(data);
        return resultFailure;
    }

    public static <T> ResponseResult<T> failure(String message, T data) {
        ResponseResult<T> resultFailure = new ResponseResult<>(ResultEnum.OPERATE_FAILURE);
        resultFailure.setMsg(message);
        resultFailure.setData(data);
        return resultFailure;
    }
}
